from aip import AipImageCensor

APP_ID = '14714200'
API_KEY = '99hwxcPovFVvdsbDfiNdpDAY'
SECRET_KEY = '1HH8xg5HBMIlUf12ktt8KMzGmYk4zzlM'

client = AipImageCensor(APP_ID, API_KEY, SECRET_KEY)


def get_file_content(filePath):
    with open(filePath, 'rb') as fp:
        return fp.read()


""" 调用色情识别接口 """
def run(path):
    result = client.imageCensorUserDefined(get_file_content(path))
    return result


""" 如果图片是url调用如下 """


def turn(path):
    result = client.imageCensorUserDefined(path)
    return result


